#include<stdio.h>
int main() {
	int n = 0;
	scanf("%d", &n);
	int arr[1000];
	int i = 0;
	for (; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	//我们用left找奇数，right找偶数
	int left = 0;
	int right = n - 1;
	while (left < right) {
		while (arr[left] % 2 != 0 && left < right) {
			if (arr[right] % 2 == 0) {
				int temp = arr[left];
				arr[left] = arr[right];
				arr[right--] = temp;
				left++;
			} else {
				right--;
			}
		}
		left++;
	}
	//打印观察结果
	for (i = 0; i < n; i++) {
		printf("%d ", arr[i]);
	}
	return 0;
}

